package leetcode_201_300;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

public class LeeCode_287 {
    public static void main(String[] args) {

    }
    private static int findDuplicate(int[] nums) {
        int slow = 0, fast = 0;
        do {
            slow = nums[slow];
            fast = nums[nums[fast]];
        }while (slow != fast);
        slow = 0;
        while (slow != fast){
            slow = nums[slow];
            fast = nums[fast];
        }
        return slow;
    }
}
